package viewCollection;
import util.Messages;
import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class ButtonPanel extends JPanel {

  private static final long serialVersionUID = 6032271057754206274L;
  private JButton buttons_[];
  
  public enum ButtonEnum { TRAITS, APTITUDES, ADVANTAGES, DISADVANTEGES};
  
  public ButtonPanel() {
    buttons_ = new JButton[6];
    setLayout(new GridLayout(0,1,4,4));
    setAlignmentX(JPanel.TOP_ALIGNMENT);
    for(int i = 0; i < buttons_.length; ++i) {
      buttons_[i] = new JButton();
      JButton j = buttons_[i];
      j.setText(Messages.getString("Button."+i));
      add(j);
    }
  }
  
  public void setButtonAction(ButtonEnum en, ActionListener e) {
    buttons_[en.ordinal()].addActionListener(e);
  }
  
  public JButton getButton(ButtonEnum en) {
    return buttons_[en.ordinal()];
  }
}
